package
{
	import mx.collections.ArrayCollection;
	
	public class ZenSlideshow
	{
		public function ZenSlideshow()
		{
		}
		
		public function getNextPhoto():ZenPhoto {
			if (currentPhotoIdx + 1 >= zenPhotos.length) {
      			currentPhotoIdx = 0;
      		} else {
      			currentPhotoIdx++;
      		}
      		return zenPhotos[currentPhotoIdx];
		}
		
		public function getRandomPhoto():ZenPhoto {
			randomise();
			return getCurrentPhoto();
		}
		
		public function getCurrentPhoto():ZenPhoto {
			return zenPhotos[currentPhotoIdx];;
		}
		
		public function addPhoto(photo:ZenPhoto):void {
			zenPhotos.addItem(photo);
		}
		
		public function getPhotoCount():int {
			return zenPhotos.length;
		}
		
		public function randomise():void {
			currentPhotoIdx = Math.round(Math.random()* (zenPhotos.length - 1));
		}

		private var zenPhotos:ArrayCollection = new ArrayCollection;
		private var currentPhotoIdx:int = 0;
	}
}